//
//  HBChapterCell.m
//  HeartBeat
//
//  Created by karong on 2023/8/31.
//

#import "HBChapterCell.h"
#import "HBChapterModel.h"

@interface HBChapterCell ()
@property (weak, nonatomic) IBOutlet UILabel *titleLabel;
@property (weak, nonatomic) IBOutlet UIImageView *imageView;
@property (weak, nonatomic) IBOutlet UILabel *statusLabel;
@end
@implementation HBChapterCell
- (void)setDataWithObject:(HBChapterModel *)object chapterId:(NSInteger)chapterId {
    self.titleLabel.text = SF(@"%@", KEmptyStr(object.title));
    self.statusLabel.text = object._is_vip?WSLocalized(@"VIP免費"):(object.had_read?WSLocalized(@"已讀"):WSLocalized(@"未讀"));
    self.statusLabel.textColor = object._is_vip?UIColor.font_yellow_FFCC00:(object.had_read ? [UIColor colorFromHexRGB:@"CECECE"]:UIColor.font_black_1A1A1A);
    self.titleLabel.textColor = UIColor.font_black_1A1A1A;
    self.imageView.hidden = YES;
    if (object.coins == 0 || object._is_buy == 1 || (appUserCenter.vip_status == 1 && object._is_vip == 1)) {
        self.imageView.image = nil;
    }
    else {
        self.imageView.hidden = NO;
        self.imageView.image = IMG(@"icon_mu_suo");
    }
    if (chapterId == object.id && object.had_read) {
        self.imageView.hidden = NO;
        self.titleLabel.textColor = UIColor.font_yellow_FFCC00;
        self.statusLabel.textColor = UIColor.font_yellow_FFCC00;
        self.imageView.image = IMG(@"icon_shuqian");
    }
    self.titleLabel.font = [UIFont systemFontOfSize:(appConfig.languageType == 2)?16:17];
}
@end
